GET 
  FILE='D:\phdproject\databases\GSS_mccutcheonyears\GSScombined_1977original.sav'. 
DATASET NAME DataSet1 WINDOW=FRONT.

RECODE colhomo colmil colrac colath (4=10) (5=9) INTO colhom2  colmil2 
    colrac2 colath2.
EXECUTE.

recode colcom (4=9) (5=10) INTO colcom2. 
execute. 

RECODE libath libcom libhomo libmil librac (1=9) (2=10) INTO libath2 libcom2 libhomo2 
    libmil2 librac2.
EXECUTE.

RECODE spkath spkcom spkhomo spkmil spkrac (1=10) (2=9) INTO spkath2 spkcom2 spkhomo2 
    spkmil2 spkrac2.
EXECUTE.

COMPUTE atheist= (spkath2+colath2+libath2).
EXECUTE.

COMPUTE racist= (spkrac2+colrac2+librac2).
EXECUTE.
COMPUTE communist= (spkcom2+colcom2+libcom2).
EXECUTE.


COMPUTE militarist= (spkmil2+colmil2+libmil2).
EXECUTE.
COMPUTE homo= (spkhomo2+colhom2+libhomo2).
EXECUTE.
#select intolerant and tolerant 

frequencies homo, militarist, communist, racist, atheist. 
execute. 

RECODE homo  militarist atheist communist racist (30=1)  (27 thru 29=0) (ELSE=SYSMIS) INTO homosexuals militarists atheists communists racists.
EXECUTE.


RECODE educ (12=1) (MISSING=SYSMIS) (0 thru 11=0) (13 thru 20=2) INTO education.
EXECUTE.


#RECODE cohort (MISSING=SYSMIS) (1887 thru 1914=0) (1915 thru 1933=1) (1933 thru 1951=2) (1952 thru 1970=3) INTO cohort2.
#EXECUTE.

RECODE cohort (MISSING=SYSMIS) (1887 thru 1914=3) (1915 thru 1933=2) (1934 thru 1951=1) (1952 thru 1970=0) INTO cohort_.
EXECUTE.


#RECODE cohort (MISSING=SYSMIS) (1887 thru 1914=0) (1915 thru 1933=1) (1934 thru 1951=2) (1952 thru 1970=3) INTO cohort3.

#RECODE cohort (MISSING=SYSMIS) (1887 thru 1914=0) (1915 thru 1932=1) (1933 thru 1951=2) (1952 thru 1970=3) INTO cohort4.


frequencies education, cohort.

#logical issue: if misisng at two vars but 0 on other 0. so change to decrease nr of misisng,in folowing if 0 on 1 of 3 indics 0, else the value from compositescore

DO IF ((spkrac2 =9) or (librac2=9) or (colrac2=9)).
COMPUTE gh = 0.
ELSE.
COMPUTE gh = 1.
END IF.


DO IF ((spkmil2 =9) or (libmil2=9) or (colmil2=9)).
COMPUTE milmis = 0.
ELSE.
COMPUTE milmis = 1.
END IF.

DO IF ((spkcom2 =9) or (libcom2=9) or (colcom2=9)).
COMPUTE commis = 0.
ELSE.
COMPUTE commis = 1.
END IF.

DO IF ((spkath2 =9) or (libath2=9) or (colath2=9)).
COMPUTE athmis = 0.
ELSE.
COMPUTE athmis = 1.
END IF.
execute.

DO IF ((spkhomo2 =9) or (libhomo2=9) or (colhom2=9)).
COMPUTE homomis = 0.
ELSE.
COMPUTE homomis = 1.
END IF.

DO IF (homomis=0).
COMPUTE homtest = 0.
ELSE.
COMPUTE homtest = homosexuals.
END IF.
execute.

DO IF (gh=0).
COMPUTE racist_ = 0.
ELSE.
COMPUTE racist_= racists.
END IF.
execute.

DO IF (commis=0).
COMPUTE communists_ = 0.
ELSE.
COMPUTE communists_ = communists.
END IF.
execute.

DO IF (milmis=0).
COMPUTE militarists_ = 0.
ELSE.
COMPUTE militarists_ = militarists.
END IF.
execute.


DO IF (athmis=0).
COMPUTE atheists_ = 0.
ELSE.
COMPUTE atheists_ = atheists.
END IF.
execute.

